import request from '@/utils/request'

export function rentalCreate(data) {
  return request({
    url: '/rental/goods/create',
    method: 'post',
    data
  })
}


export function rentalList(data) {
  return request({
    url: '/rental/goods/list',
    method: 'get',
    params: data
  })
}


export function rentalDetail(id) {
  return request({
    url: `/rental/goods/${id}`,
    method: 'get',
  })
}

//下架
export function rentalTakeDown(data) {
  return request({
    url: `/rental/goods/takeDown`,
    method: 'post',
    data
  })
}

//上架
export function rentalTakeUp(id) {
  return request({
    url: `/rental/goods/takeUp/${id}`,
    method: 'PUT',
  })
}

//编辑
export function rentalTakeUpdate(data) {
  return request({
    url: `/rental/goods/update`,
    method: 'post',
    data
  })
}


//出租
export function rentalCreateOrder(data) {
  return request({
    url: '/rental/order/create',
    method: 'post',
    data
  })
}

//审核列表
export function rentalAuditList(data) {
  return request({
    url: '/rental/goods/audit/list',
    method: 'get',
    params: data
  })
}
//审核商品
export function rentalCheck(data) {
  return request({
    url: '/rental/goods/audit',
    method: 'post',
     data
  })
}

//订单列表
export function rentalOrderlist(data) {
  return request({
    url: '/rental/order/list',
    method: 'get',
    params:data
  })
}

//订单详情
export function rentalOrderDetail(id) {
  return request({
    url: `/rental/order/${id}`,
    method: 'get',
  })
}

//修改支付状态
export function rentalOrderPay(data) {
  return request({
    url: '/rental/order/update/payStatus',
    method: 'post',
    data
  })
}

//一键拉群
export function rentalOrderPull(id) {
  return request({
    url: `/rental/order/group/pull/${id}`,
    method: 'get',
  })
}
//解散群组
export function rentalOrderCancel(id) {
  return request({
    url: `/rental/order/group/cancel/${id}`,
    method: 'put',
  })
}
//恢复群组
export function rentalOrderRecover(id) {
  return request({
    url: `/rental/order/group/recover/${id}`,
    method: 'get',
  })
}

//订单转出租中
export function rentalOrderRenting(id) {
  return request({
    url: `/rental/order/renting/${id}`,
    method: 'put',
  })
}

//取消订单
export function rentalCancel(data) {
  return request({
    url: `/rental/order/cancel`,
    method: 'put',
    data
  })
}

//完成订单

export function rentalComplete(data) {
  return request({
    url: `/rental/order/complete`,
    method: 'put',
    data
  })
}


//同步订单支付状态
export function rentalRefund(id) {
  return request({
    url: `/rental/order/check/refund/${id}`,
    method: 'get',
  })
}